package com.zhan.utils.log.service.impl;

import com.zhan.utils.Constants;
import com.zhan.utils.SysLogUtils;
import com.zhan.utils.log.service.LogService;
import com.zhan.utils.model.CurrentUserInfo;
import com.zhan.utils.model.SysLog;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RedissonClient;

@Slf4j
public class LogServiceImpl implements LogService {

    private RedissonClient redissonClient;

    @Override
    public void sendLog(Object object, Integer type, CurrentUserInfo currentUserInfo) {
        redissonClient.getQueue(Constants.QueueName.SYS_LOG).add(SysLogUtils.getSysLog(object, type, currentUserInfo));
    }

    @Override
    public void sendLog(SysLog sysLog) {
        redissonClient.getQueue(Constants.QueueName.SYS_LOG).add(sysLog);
    }

    public RedissonClient getRedissonClient() {
        return redissonClient;
    }

    @Override
    public void setRedissonClient(RedissonClient redissonClient) {
        this.redissonClient = redissonClient;
    }

}
